package com.newegg.app.qec.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.newegg.app.qec.R;
import com.newegg.app.qec.adapter.AddressAdapter;
import com.newegg.app.qec.util.BaseActivity;
import com.newegg.app.qec.view.MyListView;

import java.util.ArrayList;

/**
 * Created by Allen on 2017/12/13.
 */
public class AddressActivity extends BaseActivity implements View.OnClickListener {
    private ImageView back;
    private TextView name;
    private ListView listview;
    private LinearLayout no_data;
    private AddressAdapter addressAdapter;
    private TextView address_tv1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_address);
        back = (ImageView) findViewById(R.id.img_back);
        name = (TextView) findViewById(R.id.title_name);
        listview = (ListView) findViewById(R.id.activity_address_lv);
        no_data = (LinearLayout) findViewById(R.id.no_data_linearlayout);
        address_tv1 = (TextView) findViewById(R.id.activity_address_tv1);
        name.setText("收货地址");
        back.setOnClickListener(this);
        address_tv1.setOnClickListener(this);
        no_data.setVisibility(View.VISIBLE);
//        listview.setVisibility(View.VISIBLE);
//        address_tv1.setVisibility(View.VISIBLE);
        ArrayList<String> list = new ArrayList<>();
        list.add("1");

        addressAdapter = new AddressAdapter(AddressActivity.this,list);
        listview.setAdapter(addressAdapter);
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.img_back:
                finish();
                break;
            case R.id.activity_address_tv1:
                intent.setClass(AddressActivity.this,AddAddressActivity.class);
                startActivity(intent);
                break;
        }
    }
}
